

from appium.webdriver.common.appiumby import AppiumBy
from AppTest.page.base_page import BasePage


class RulePage(BasePage):

    # 编辑规则
    __BUEEON_RULEDETAIL = (AppiumBy.XPATH, "//*[@text='新建规则']/parent::*/parent::*/following::*[1]")
    # 删除规则
    __BUTTON_DELETE = (AppiumBy.XPATH, "//*[@text='删除规则']")
    # 立即生效按钮
    __BUTTON_SAVENOW = (AppiumBy.XPATH, "//*[@text='立即生效']")
    # 确定按钮
    __BUTTON_CONFIRM = (AppiumBy.XPATH, "//*[@text='确定']")

    def click_ruledetail(self):
        self.do_click(self.__BUEEON_RULEDETAIL)

    def click_delete(self):
        self.do_click(self.__BUTTON_DELETE)

    def click_savenow(self):
        self.do_click(self.__BUTTON_SAVENOW)

    def click_confirm(self):
        self.do_click(self.__BUTTON_CONFIRM)